package ArrayDeque;

import org.junit.jupiter.api.Test;

import java.util.List;

import static org.junit.jupiter.api.Assertions.*;

class ArrayDequeTest {
       ArrayDeque<Integer> deque = new ArrayDeque<Integer>(5);
    @Test
    void offer() {
        deque.offerFirst(2);
        deque.offerFirst(1);
        deque.offerLast(3);
        deque.offerLast(4);
        deque.offerLast(5);
        assertFalse(deque.offerLast(6));
        assertIterableEquals(List.of(1,2,3,4,5),deque);
    }

    @Test
    void poll() {
        deque.offerFirst(2);
        deque.offerFirst(1);
        deque.offerLast(3);
        deque.offerLast(4);
        deque.offerLast(5);
        assertEquals(5,deque.pollLast());
        assertEquals(4,deque.pollLast());
        assertEquals(1,deque.pollFirst());
        
    }
}